//
//  SexTableViewCell.m
//  Shengzhuli
//
//  Created by 卡忙科技 on 16/9/21.
//  Copyright © 2016年 kamangkeji. All rights reserved.
//

#import "SexTableViewCell.h"

@interface SexTableViewCell()

@property (weak, nonatomic) IBOutlet UIButton *manBtn;
@property (weak, nonatomic) IBOutlet UIButton *womenBtn;
@property (nonatomic,weak) UIButton *lastSelectBtn;

@end

@implementation SexTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (IBAction)sexClick:(UIButton *)btn
{
    if (btn == self.lastSelectBtn) return;
    self.lastSelectBtn.selected = NO;
    btn.selected = YES;
    self.lastSelectBtn = btn;
    if (btn == self.manBtn) {
        self.info.gender = 1;
    }else{
        self.info.gender = 2;
    }
}
- (void)setInfo:(PersonInfo *)info
{
    _info = info;
    if (info.gender == 1) {
        self.manBtn.selected = YES;
        self.lastSelectBtn = self.manBtn;
    }else if (info.gender == 2){
        self.womenBtn.selected = YES;
        self.lastSelectBtn = self.womenBtn;
    }
}

@end
